﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Common;

public partial class website_admin_members_changepassword : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Expires = -1;

        /// 保存设置
        if (RequestBase.GetFormString("___EVENTTARGET") == "save")
        {
            UpdatePassword();
        }

        if (!IsPostBack)
        {
            txtUsername.Value = RequestBase.GetQueryString("username");
        }
    }

    void UpdatePassword()
    {
        Model.Enum.MembershipCreateStatus status;

        (new BLL.MembershipBase()).ChangePassword(txtUsername.Value.Trim(), txtPassword.Value.Trim(), out status);

        switch ((int)status)
        {
            case 0:
                JScript.AlertAndReturnValueToParent("保存成功!", "window.close();");
                break;
            default:
                JScript.Alert(status.ToString());
                break;
        }
    }
}
